﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DDD.Core;
using FloatComparer = DDDTest.Helper.FloatComparer;

namespace DDDTest.Core {

    [TestClass]
    public class TestAnimationPlayer {
        [TestMethod]
        public void Test_New () {
            var player = new AnimationPlayer ();

            Assert.AreEqual (0, player.ClipCount);
            Assert.AreEqual (0, player.Clips.Count ());
        }

        [TestMethod]
        public void Test_AddClip () {
            var player = new AnimationPlayer ();
            var clip0 = new AnimationClip ("Clip name 0");
            var clip1 = new AnimationClip ("Clip name 1");

            player.AddClip (clip0);
            player.AddClip (clip1);

            Assert.AreEqual (2, player.ClipCount);
            Assert.AreEqual (clip0, player.GetClip (0));
            Assert.AreEqual (clip1, player.GetClip (1));
        }

        [TestMethod]
        public void Test_RemoveClip () {
            var player = new AnimationPlayer ();
            var clip0 = new AnimationClip ("Clip name 0");
            var clip1 = new AnimationClip ("Clip name 1");

            player.AddClip (clip0);
            player.AddClip (clip1);
            var removed1 = player.RemoveClip (clip0);
            var removed2 = player.RemoveClip (clip0);

            Assert.AreEqual (true, removed1);
            Assert.AreEqual (false, removed2);
            Assert.AreEqual (1, player.ClipCount);
            Assert.AreEqual (clip1, player.GetClip (0));
        }

    }
}
